<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--服务商管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="stylesheet" href="__STATIC_URL__/static/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <script src="__STATIC_URL__/static/jquery/2.2.1/jquery.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="__STATIC_URL__/static/layer/layer.js"></script>
</head>

<body>
{include file='public/header'/}
<section>
    <!------------------导航-------------------------->
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <ul class="breadcrumb">
                <li>当前位置是:</li>
                <li><a href="{:url('momach/momachlist')}">商户管理</a></li>
                <li><a href="javascript:history.back();">门店列表</a></li>
                <li class="active" style="color: #02b87f;">门店详情</li>
            </ul>
        </div>
        <div class="panel">
            <div class="panel-heading addCharts" style="background:#ededed;">添加商户</div>
            <div class="panel-body">
                <form class="form-horizontal adminex-form" action="" method="post" id="mach" enctype="multipart/form-data">
                    <ul id="myTab" class="nav nav-tabs">
                        <li class="active"><a href="#jichu" data-toggle="tab">基础信息</a></li>

                    </ul>
                    <div id="myTabContent" class="tab-content" style="padding-top:15px;">
                        <div class="tab-pane fade in active" id="jichu">
                            <div class="form-group" id="ferror1">
                                <label class="col-sm-2 col-sm-2 control-label">商户名称</label>
                                <div class="col-sm-10">
                                    <input type="hidden" id="did" data-id="{$mach.id}">
                                    <input type="text" class="form-control ipt4" readonly id="merchant" name="merchant" value="{$mach.merchant}" >
                                    <div id="error1" class="error"></div>
                                </div>
                            </div>
                            <div class="form-group" id="ferror2">
                                <label class="col-sm-2 col-sm-2 control-label">商户号</label>
                                <div class="col-sm-10">

                                    <input type="text" class="form-control ipt4" readonly id="sub_mch_id" name="merchant" value="{$mach['sub_mch_id']}" >
                                    <div id="error2" class="error"></div>
                                </div>
                            </div>

                            <div class="form-group" id="ferror3">
                                <label class="col-sm-2 col-sm-2 control-label">商户联系人</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control ipt4" readonly id="contacts" name="contacts" value="{$mach['MerchantContent']['contacts']}" >
                                    <div id="error3" class="error"></div>
                                </div>
                            </div>
                            <div class="form-group" id="ferror4">
                                <label class="col-sm-2 col-sm-2 control-label">商户电话</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control ipt4" readonly id="tel" name="tel" value="{$mach['MerchantContent']['tel']}">
                                    <div id="error4" class="error"></div>
                                </div>
                            </div>
                            <div class="form-group" id="ferror5">
                                <label class="col-sm-2 col-sm-2 control-label">商户地址</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control ipt6" readonly id="address" name="address"  value="{$mach['MerchantContent']['address']}">
                                    <div id="error5" class="error"></div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">选择通知公众号<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                <div class="col-sm-9 col-xs-12">
                                    <select name="tpl_msg_type" class="form-control"  id="tpl_msg_type" required>

                                        <option value="1" {if condition="$mach['tpl_msg_type'] eq '1'"}selected{/if}>系统公众号</option>
                                        <option value="2" {if condition="$mach['tpl_msg_type'] eq '2'"}selected{/if}>代理商公众号</option>
                                        <option value="3" {if condition="$mach['tpl_msg_type'] eq '3'"}selected{/if}>商户公众号</option>
                                    </select>
                                    <div class="text-danger">选择的公众号为收银报表通知发送的公众号</div>
                                </div>
                            </div>

                            <div class="form-group" id="levelst" id="ferror7">
                                <label class="col-sm-2 col-sm-2 control-label">代理商</label>
                                <div class="col-lg-10">
                                    <select class="form-control input-sm m-bot15  ipt4" readonly name="agent" id="agent" onchange="sales()">
                                        <option value="{$mach['agent']}">{:getagent($mach['agent'],"name")}</option>

                                    </select>
                                    <div id="error7" class="error"></div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">业务员</label>
                                <div class="col-lg-10">
                                    <select class="form-control input-sm m-bot15 ipt4" name='salesman' readonly id='salesman'>
                                        <option value='{$mach.salesman}'>{:getsales($mach['salesman'])}</option>

                                    </select>
                                </div>
                            </div>


                        </div>

                    </div>
                    <div style="text-align: center">

                        <button type="button" onclick="addform()" class="btn btn-primary">确认修改</button>
                    </div>
                </form>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>


</body>
<script type="text/javascript">
    function addform(){
        var tpl_msg_type=$("#tpl_msg_type").val();
        var did=$("#did").attr("data-id");
        $.ajax({
            url: "{:url('momachtest/machxg')}",
            data: {
                id:did,
                tpl_msg_type: tpl_msg_type
            },
            type: "post",
            success: function (data) {
                console.log(data)
                if(data.code==0){
                    layer.msg("修改成功", {icon: 1,time:1000});
                    //setTimeout("window.location.reload()",1000);
                    return false;
                }else{
                    layer.alert(data.message);
                    return false
                }
            }
        })
    }


</script>

</html>